import dns.resolver

# 'A'表示将主机名转换为IP地址
a = dns.resolver.resolve("www.tmooc.cn",'A')
print(a.rrset)
for i in a.response.answer:
    print('{}{}'.format('i:',i))
    for j in i.items:
        print('{}{}'.format('j:',j))
